﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Personal : System.Web.UI.Page
{

    void FillInfo(MemDisplay m)
    {
        string path="";
        if (m.hasAvatar == 1)
            path += "./avatar/" + m.uid.ToString() + "-Big.png";
        else
            path += "./avatar/noavatar_middle.gif";
        personal_photo.Src = path;



        //Literal_psninfo
        personal_user.Text = "用户名" + " (UID:" + m.uid + ")";

        string R = "";
        R += "<p>" + "昵称:    " + m.nickname + "</p>";
        R += "<p>" + "性别:    " + m.gender + "</p>";
        R += "<p>" + "QQ:    " + m.QQ + "</p>";
        R += "<p>" + "email:    " + m.email + "</p>";
        R += "<p>" + "生日:    " + m.birthday + "</p>";
        Literal_psninfo.Text=R;

        personal_group.Text = "用户组" + "(GID:" + m.gid + ")";
        string P = "";
        P += "<p>" + "点击:    " + m.viewSum + "</p>";
        P += "<p>" + "回复:    " + m.repSum + "</p>";
        m.GetOnlineTime();
        P += "<p>" + "在线时间:    " + m.online.Days + "天" + m.online.Hours+"小时" + m.online.Minutes+ "分钟" + "</p>";
        Literal_statics.Text = P;

    }


    protected void Page_Load(object sender, EventArgs e)
    {
        CGeneral.CheckLogin(Request, Session);

        int uid = Check.CheckToInt(Request.QueryString["uid"].ToString());
        if(uid==-1)
        {
            //error
            CGeneral.GoToErrorPage(Response, "custom", "uid不合法");
        }

        MemDisplay m = new MemDisplay(uid);
        if (m.isExist == 0)
        {
            CGeneral.GoToErrorPage(Response, "custom", "该用户不存在");
        }
        FillInfo(m);
    }
}